package broadcast;


import static android.content.ContentValues.TAG;

import android.annotation.SuppressLint;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.util.Log;
import android.widget.TextView;
import android.widget.Toast;

import com.example.kitchen.R;


public class KitchenReceiver extends BroadcastReceiver {
    private Message message;

    @Override
    public void onReceive(Context context, Intent intent) {
        //接收MainActivity传过来的数据
        Toast.makeText(context, "有新的订单，请注意查收！", Toast.LENGTH_SHORT).show();
        String orderStr = "";
        String foodNames = intent.getStringExtra("foodList");
        String CreateTime = intent.getStringExtra("createTime");
        //调用Message接口的方法
        message.getMsg(foodNames + "\n" + CreateTime + "\n");
    }

    public interface Message {
        public void getMsg(String str);
    }

    public void setMessage(Message message) {
        this.message = message;
    }
}
